<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<%@ include file="/module/js.jsp"%>
<%@ include file="/module/orderField.jsp"%>
<style>
table label.error {
	margin-left: 5px;
	width: auto;
	display: inline;
	color: red;
}
</style>
<script>
	$(document)
			.ready(
					function() {
						var _form = $("#Form").validate();
						//返回
						$('#btnBack').click(function() {
							document.Form.action = "${basePath}/teacherReviewGroup/index";
							document.Form.submit();
										
					  });
						//返回
						$('#btnBack2').click(function() {
							document.Form.action = "${basePath}/teacherReviewGroup/index";
							document.Form.submit();
										
					  });
						//保存
						$("#btnSave").click(
							function() {
								if (_form.form()) {
								valdateReviewTeacherGroup();	
								}
							});
						
					});
	   function valdateReviewTeacherGroup(){
		   $("#msg02").html("");
		   var   mySelect = document.getElementById("toSelect");
		   if(mySelect.length==0){
			   $("#msg02").html("这一项必须填写.");
			   return false;
		   }else{
			   var empids="";
			   for(i=0;i<mySelect.length;i++){
				  if(i==0){
				   empids=mySelect[i].value; 
				  }else{
					empids=empids+","+mySelect[i].value;    
				  }
			   }
			   $("#empids").val(empids);
		   }
			$.ajax({
               type: "post",
               url: "${basePath}/teacherReviewGroup/valdateReviewTeacherGroup",
               data: { groupname :$("#groupname").val(),groupid:$("#groupid").val()},
               success: function(data){
            	   if(data==-1){
            		  layer.alert("专家组名称不能为空", {icon: 6});
            		  return false;
            	   }else if(data==1){
            		  layer.alert("专家组名称重复", {icon: 6});
            		  return false;   
            	   }else if(data==0){
						document.Form.action = "${basePath}/teacherReviewGroup/modiftyReviewTeacherGroup";
						document.Form.submit();   
            	   }else{ //不符合条件
       		       layer.alert("服务器异常", {icon: 6});
        		       return false;	  
       		      }      
               }
  	   		});   
		   
		   
	   }
</script>
</head>
<body onload="javascript:viewOrEdit();">
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="groupid" id="groupid"
			value="${ktglReviewGroup.groupid}" />
		<div id="view">
			<table cellpadding="0" cellspacing="0" border="0"
				class="table-border" width="80%">
				<tr>
					<td class="table-header" colspan="2">专家组管理</td>
				</tr>
				<tr>
				<td class="table-titleTD" style="width: 30%">专家组名称：</td>
				<td class="table-contentTD" style="width: 70%">
				${ktglReviewGroup.groupname}
				</td>
			  </tr>
			  	<tr>
				<td class="table-titleTD" style="width: 30%">成员：</td>
				<td class="table-contentTD" style="width: 70%">
				<select  multiple="multiple" style="width:220px; height: 300px;" disabled="disabled">
  	   				   <c:forEach items="${KtglReviewExpertList}" var="em">
  	   				   <option value="${em.empid}">${em.xm}</option>
  	   				   </c:forEach>
					</select>
				</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%">备注：</td>
				<td class="table-contentTD" style="width: 21%"><textarea  style="width: 70%;height: 80px;" disabled="disabled">${ktglReviewGroup.remark}</textarea>
				</td>
			</tr>
			</table>
		</div>
		<br/>
		<div id="edit" style="display: none;">
		<table cellpadding="0" cellspacing="0" border="0"
				class="table-border" width="80%">
				<tr>
					<td class="table-header" colspan="2">专家组管理</td>
				</tr>
				<tr>
				<td class="table-titleTD" style="width: 12%"><font style="color: red;">*</font>专家组名称：</td>
				<td class="table-contentTD" style="width: 21%"><input type="text" id="groupname" name="groupname" value="${ktglReviewGroup.groupname}" autocomplete="off" class="inputText required" placeholder="请输入专家组名称"/>
				</td>
			</tr>
				<tr>
				<td class="table-titleTD" style="width: 12%"><font style="color: red;">*</font>成员：</td>
				<td style="clear:both; width:21%" class="table-contentTD">
							 <table border="0" cellpadding="0" cellspacing="0">
				 <tr>
				 <td>
				 <input autocomplete="off" class="inputText" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"/><font color="green">在此查找</font> <br/>
  	   				<br/><label style="color:red;">未选中:</label><br/>
  	   				<select name="fromSelect" id="fromSelect" multiple="multiple" class="inputText"  style="width:220px; height: 300px;" ondblclick="moveField('fromSelect','toSelect');">
  	   				   <c:forEach items="${employeeList}" var="employee">
  	   				   <option value="${employee.emid}">${employee.xm}</option>
  	   				   </c:forEach>
					</select>
					<select name="sourseFromSelect2" id="sourseFromSelect2" multiple="multiple" style="width: 220px; height: 150px; display: none;" >
					 <c:forEach items="${employeeList}" var="employee">
  	   				   <option value="${employee.emid}">${employee.xm}</option>
  	   				   </c:forEach>
  	    				</select>
  	    			</td>
  	    			 <td align="center" style="width: 10%">
  	   				 <input type="button" class="inputButton" onclick="moveAllField('fromSelect','toSelect');" style="width: 40px;" value=">>" />
					<br>
					 <br/>
					<input type="button" class="inputButton" onclick="moveField('fromSelect','toSelect');" style="width: 40px;" value=">" />
	 			   <br/>
	               <br/>
					<input type="button" class="inputButton"  style="width: 40px;" value="&lt" onclick="moveField('toSelect','fromSelect');"/><br/> <br/>
     				<input type="button" class="inputButton" style="width: 40px;" onclick="moveAllField('toSelect','fromSelect');"  value="&lt&lt" />
     				</td>
     			  <td style="width: 45%;bottom: 0"><br/><br/><label style="color:red;">已选中:</label><br/>
     				<select name="toSelect" id="toSelect" multiple="multiple"  class="inputText"   style="width:220px;height: 300px;" ondblclick="moveField('toSelect','fromSelect');">
					  <c:forEach items="${KtglReviewExpertList}" var="em">
  	   				   <option value="${em.empid}">${em.xm}</option>
  	   				   </c:forEach>
					</select><span style="color: red;" id="msg02"></span>
					<input type="hidden" id="empids" name="empids" value="" />
     			 </td>
     			 </tr>
				 </table>
				 </td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%">备注：</td>
				<td class="table-contentTD" style="width: 21%" ><textarea  id="remark" name="remark" style="width: 70%;height: 80px;" placeholder="请输入备注信息" >${ktglReviewGroup.remark}</textarea>
				</td>
			</tr>
			</table>
		</div>
		<br />
		<div id="button-view">
			<table cellpadding="1" cellspacing="1" border="0" align="left">
				<tr>
					<%-- 					<kl:permission permisstionList="${permisstionList}" --%>
					<%-- 										currentUser="${_login_console_user}" --%>
					<%-- 											currentCatalogId="<%=CatalogUtils.getCatalogId("XGGL_QMPB_QMZJ_BZR")%>" key="modify"> --%>
					<td><input type="button" id="btnEdit" class="inputButton"
						style="text-align: center;" value="修改"
						onclick="javascript:gotoEditPage();" /></td>
					<%-- 				   </kl:permission> --%>
					<td><input type="button" id="btnBack" class="inputButton"
						value="返回" style="text-align: center;" /></td>
				</tr>
			</table>
		</div>
		<div id="button-edit">
			<table cellpadding="1" cellspacing="1" border="0" align="left">
				<tr>
					<td><input type="button" id="btnSave" class="inputButton"
						style="text-align: center;" value="保存" autocomplete="off" /></td>
					<td><input type="button" id="cancelSave" class="inputButton"
						style="text-align: center;" value="取消" autocomplete="off"
						onclick="javascript:gotoViewPage();" /></td>
					<td><input type="button" id="btnBack2" autocomplete="off"
						class="inputButton" value="返回" style="text-align: center;" /></td>
				</tr>
			</table>
		</div>
	</form>
</body>
</html>
